﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StonePonyMVC.StonePony.Classes;
using System.Web;
using StonePonyMVC.Models;

namespace StonePonyMVC.StonePony.Services
{
    public interface IImageService
    {
        /// <summary>
        /// Prepares list with images
        /// </summary>
        /// <param name="url">Home url</param>
        /// <param name="server">Server, <see cref="HttpServerUtilityBase"/></param>
        /// <param name="selectedCategoryName">Selected category id</param>
        /// <returns>list with images</returns>
        IEnumerable<ImageDescriptor> GetAllImages(string url, HttpServerUtilityBase server, string selectedCategoryName);
        IEnumerable<CategoryImageDescriptor> GetCategoryImages(string url, HttpServerUtilityBase server, int? selectedCategoryId);
        IEnumerable<ImageDescriptor> GetEnquiredImages(string url, HttpServerUtilityBase server, long sessionId);

        /// <summary>
        /// Returns image descriptor for item which code is equal to parameter's value
        /// </summary>
        /// <param name="url">Home url</param>
        /// <param name="server">Server, <see cref="HttpServerUtilityBase"/></param>
        /// <param name="itemCode">Image ID</param>
        /// <param name="pathModifier">Word that is into image URL after word "Shipments"</param>
        /// <returns></returns>
        ImageDescriptor GetImage(string url, HttpServerUtilityBase server, int itemCode, string pathModifier = null);

        /// <summary>
        /// Writes data to enquiries table
        /// </summary>
        /// <param name="request">Request <see cref="SubmitEnquiryRequestModel"/></param>
        /// <returns>Response <see cref="SubmitEnquiryResponseModel"/></returns>
        SubmitEnquiryResponseModel WriteEnquiry(SubmitEnquiryRequestModel request);

        /// <summary>
        /// Finalize enquiry request
        /// </summary>
        /// <param name="sessionId">Session ID</param>
        /// <returns>Response <see cref="SubmitEnquiryResponseModel"/></returns>
        SubmitEnquiryResponseModel SendEnquiry(long sessionId);

        /// <summary>
        /// Marks enquiries as canceled
        /// </summary>
        /// <param name="sessionId">Session ID</param>
        /// <returns>Response <see cref="SubmitEnquiryResponseModel"/></returns>
        SubmitEnquiryResponseModel ClearEnquiry(long sessionId);

        /// <summary>
        /// Removes enquiry as from session
        /// </summary>
        /// <param name="sessionId">Session ID</param>
        /// <param name="itemCode">Image ID</param>
        /// <returns>Response <see cref="SubmitEnquiryResponseModel"/></returns>
        SubmitEnquiryResponseModel DeleteEnquiry(long sessionId, int itemCode);

        /// <summary>
        /// Creates letter model for defined session
        /// </summary>
        /// <param name="sessionId">Session ID</param>
        /// <param name="server">Context data <see cref="HttpServerUtilityBase"/></param>
        /// <param name="rootUrl">URL of the StonePony application</param>
        /// <returns>Data for letter generation</returns>
        LetterModel GetLetterModel(long sessionId, HttpServerUtilityBase server, string rootUrl);

        /// <summary>
        /// Adds close sign to right top corner of the image
        /// </summary>
        /// <param name="imagePath">Physical path to image</param>
        /// <returns>Modified image</returns>
        byte[] GetModifiedImage(string imagePath);
    }
}
